/*
 * a_star.h
 *
 *  Created on: 14. sep. 2012
 *      Author: Gaute and Fredrik
 */

#ifndef A_STAR_H_
#define A_STAR_H_

using namespace std;

#include <vector>
#include <map>
#include <queue>
#include <string>

class Node {
	private:
		Node* bestParent;
		vector<Node*> possibleParents;
		vector<Node*> children;
		double g;
		double h;
		double f;
		bool isSolution;
	public:
		Node();
		Node(int, int);
		double getG(void);
		double getH(void);
		double getF(void);

		// So that compareNode works
		double fValue(void) const { return f; };

		void setG(int);
		void setH(int);
		void calcF(void);
		Node* getBestParent(void);
		void setParent(Node*);
		void insertChild(Node*);
		vector<Node*> getChildren();
		bool getIsSolution(void);
		double heuristicFunc(void);
		void makeNodeChildren(void);

		friend bool operator < (const Node& n1, const Node& n2);
};

struct CompareNode : public std::binary_function<Node*, Node*, bool> {
	bool operator()(const Node* lhs, const Node* rhs) const {
		return lhs->fValue() > rhs->fValue();
	}
};



//map<int, Node> tree;
Node* aStarPath (int searchProblem, int herusticFuncH);


#endif /* A_STAR_H_ */
